package ca.bcit.comp_3512.assignment_02.data_models;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name="users")
public class User implements Serializable
{
    private static final long serialVersionUID = 1L;
    
    @Column(name="first_name")
    private String firstName;
    
    @Column(name="last_name")
    private String lastName;
    
    @Column(name="password")
    private String password;
    
    @Column(name="super_user", columnDefinition="BIT")
    private boolean superUser;
    
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name="user_id")
    private Integer userID;
    
    //@OneToMany(mappedBy="User")
    @OneToMany(fetch=FetchType.EAGER, mappedBy="user")
    private List<WeeklyEntry> weeklyEntries;
    
    public User() {}
    
    public String getFirstName() {return this.firstName; }
    public String getLastName() { return this.lastName; }
    public String getPassword() { return this.password; }
    public boolean getSuperUser() { return this.superUser; }
    public Integer getUserID() { return this.userID; }
    public List<WeeklyEntry> getWeeklyEntries() { return this.weeklyEntries; }
    
    public void setFirstName(String firstName) { this.firstName = firstName; }
    public void setLastName(String lastName) { this.lastName = lastName; }
    public void setPassword(String password) { this.password = password; }
    public void setSuperUser(boolean superUser) { this.superUser = superUser; }
    public void setUserID(Integer userID) { this.userID = userID; }
    public void setWeeklyEntries(List<WeeklyEntry> weeklyEntries) { this.weeklyEntries = weeklyEntries; }
}
